<template>
  <div class="content">
     <el-form ref="form" :model="form" >
    <div class="search">
        <el-form-item label="姓名" class="label">
          <el-input v-model="form.name" class="input" placeholder="请输入姓名"></el-input>
        </el-form-item>
         <el-form-item label="单元-门牌" class="label">
           <el-select placeholder="请输入楼栋号" class="input"></el-select>
         <!--  <el-input v-model="form.name" class="input"></el-input> -->
        </el-form-item>
         <el-form-item >
            <el-button type="primary" @click="onSubmit" size="mini">查询</el-button>
          </el-form-item>
    </div>
    </el-form>
    <el-table
    ref="singleTable"
    :data="tableData"
    :header-cell-style="{background: '#EBECF0',height:'44px',color:'#000000'}"
    :cell-style="{background: '#ffffff',height:'44px',color:'#000000'}"
    highlight-current-row
    style="width: 100%">
    <el-table-column
      label="序号"
      type="index"
      :index="indexMethod"
      width="100">
    </el-table-column>
    <el-table-column
      property="name"
      label="姓名">
    </el-table-column>
    <el-table-column
      property="sex"
      label="性别">
    </el-table-column>
    <el-table-column
      property="community"
      label="所在小区">
    </el-table-column>
    <el-table-column
      property="door"
      label="单元-门牌">
    </el-table-column>

     <el-table-column
      property="address"
      label="户籍所在地">
    </el-table-column>
    <el-table-column
      property="time"
      label="申请时间">
    </el-table-column>
     <el-table-column
      property="applyer"
      label="申请人">
    </el-table-column>
     <el-table-column
      property="reviewer"
      label="审核人">
    </el-table-column>
    <el-table-column
      property="address"
       width="100"
      label="操作">
     <template slot-scope="scope">
       <el-button type="text" @click="handleClick(scope.row.id)">查看</el-button>
        </template>
    </el-table-column>
  </el-table>
  <div class="pagination">
      <el-pagination
        :current-page.sync="page"
        background
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @current-change="handleCurrentChange"
      />
  </div>
  <!-- 图片放大 -->
    <img-dialog v-if="isShownimg" :img="chooseImg" @closeImg="closeImg"></img-dialog>
      <el-dialog title="" :visible.sync="dialogFormVisible" width="60%">
      <Dangan ></Dangan>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import ImgDialog from '@/components/Imgdialog'
import Dangan from '../person/dangan'
export default {
  name: 'Dashboard',
  data() {
    return {
      form:{

      },
      tableData:[
        {name:'张扬阳',sex:'男',community:'新丰苑三期',door:'1-301',address:'江苏-无锡',time:'2020-10-23 12:23:12',applyer:'王浩',reviewer:'周华东'}
      ],
      total:100,
      page:10,
      pageSize:10,
      isShownimg:false,
      chooseImg:null,
      dialogFormVisible:false
    }
  },
   components:{
    ImgDialog,Dangan
  },
  computed: {
    ...mapGetters([
      'communityId'
    ]),
      indexMethod(index) {
        return (this.page-1)*10+index+1;
      }
  },
  created() {

  },
  methods: {
     handleClick(){
      this.dialogFormVisible=true
    },
    showImg(img){
      this.isShownimg=true
      this.chooseImg=img
    },
    handleCurrentChange(val){
      this.page=val
    },
    closeImg(){
      this.isShownimg=false
    }
  },
  watch: {
    communityId(newVal,oldVal){
      console.log('changed')
    }
  },
}
</script>
<style lang="scss" scoped>
.content{
  background: #ffffff;
  padding:25px;
  padding-bottom: 100px;
  min-height: 800px;
  position: relative;
  .search{
    display: flex;
    align-items: flex-end;
    border-bottom: 2px solid #DCDEE3;
    margin-bottom: 30px;
  }
  .input{
    width: 346px;
  }
  .label{
    margin-right: 20px;
    color: #666666;
    font-size: 14px;
  }
  .pagination{
    position: absolute;
    right: 0;
    bottom: 0;
    margin: 50px;
  }
  .img{
    width: 50px;
    height: 34px;
  }
}
</style>
<style>
.input .el-input__inner{
   height: 28px !important;
}
</style>
